//
//  BasePresentNavBar.swift
//  LeTu
//
//  Created by gy on 2023/11/30.
//

import UIKit

class BasePresentNavBar: UIView {

    init(title: String, target: Any, action: Selector) {
        super.init(frame: .zero)
        
        configUI()
        titleLabel.text = title
        closeBtn.addTarget(target, action: action)

    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        configUI()
    }
    
    // MARK: - configUI
    func configUI() {
        
        addSubview(backView)
        backView.addSubview(titleLabel)
        backView.addSubview(closeBtn)
        
        backView.snp.makeConstraints { make in
            make.left.bottom.right.equalToSuperview()
            make.height.equalTo(Size.navigationBarWithoutStatusHeight)
        }
        titleLabel.snp.makeConstraints { make in
            make.left.equalTo(30)
            make.centerY.equalToSuperview()
        }
        closeBtn.snp.makeConstraints { make in
            make.right.equalTo(-20)
            make.top.bottom.equalToSuperview()
            make.width.equalTo(44)
        }
        
    }
    private lazy var backView: UIView = {
        let backView = UIView()
        return backView
    }()
    private lazy var titleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.font = kSetPingFangMedium(20)
        return titleLabel
    }()
    private lazy var closeBtn: CustomClickableView = {
        let closeBtn = CustomClickableView()
        closeBtn.setImage(UIImage(named: "close_black"))
        return closeBtn
    }()
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
